import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    server: {
      // 为了解决 SharedArrayBuffer is NOT supported
      headers: {  //为每个请求添加自定义头
        'Cross-Origin-Opener-Policy': 'same-origin',//保护源站免受攻击
        'Cross-Origin-Embedder-Policy': 'require-corp'//保护源站免受侵害
      },
      proxy: {

      }
    },
    plugins: [vue()]
  }
})
